<%@ tag language="java" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/layouts/include/taglib.jsp" %> 

<%@ attribute name="name" required="false" %>
<%@ attribute name="dataUrl" required="false" %>
<%@ attribute name="type" required="true" %>
<%@ attribute name="optionValue" required="false" %>
<%@ attribute name="optionName" required="false" %>
<%@ attribute name="id" required="false" %>
<%@ attribute name="css" required="false" %>
<%@ attribute name="style" required="false" %>
<%@ attribute name="onchange" required="false" %>



<c:if test="${empty optionValue}">
	<c:set var="optionValue" value="codeNo"></c:set>
	
</c:if>

<c:if test="${empty optionName}">
	<c:set var="optionName" value="codeName"></c:set>
	
</c:if>


<script type="text/javascript">

function adessUrl(){
	if(${not empty dataUrl}){
		return "${dataUrl}";
	}
	return "${ctx}/sys/code/queryCodeInfo.do";
}


	Otod.ajax({
		url : adessUrl(),
		data : "${type}",
		successFn:function(data){
		var sb = new StringBuffer();
			for(var i=0;i<data.length;i++){
		        sb.append(" ");
				sb.append('<button id="').append(data[i].${optionValue}).append('" name="').append(data[i].${optionValue}).append('" value="').append(data[i].${optionName}).append('" type="button" onclick="changeState(this,event);"  class="btn btn-xs btn-checkBox  dynamic" data-toggle="button"> <i class="icon-ok"></i>');
		       	sb.append(data[i].${optionName});
		        sb.append("</button>");
			}
			 $("#tdone").html(sb.toString());
		}
	});

	
	 function changeState(a,b){
			$(a).addClass(".active");
			$(a).siblings(".active").removeClass("active");
		}; 
		
	
	$(document).ready(function() {
			
	});
    
    
 
</script>

	
	<div id="tdone"></div>
	
 